<template>
    <div>
        <p>传来的name: {{name}}</p>
        <button @click="handleClick">改变name</button>
    </div>

</template>

<script>
import {toRef} from "vue";
export default {
    props: {
        name: {
            type: toString
        }
    },
    // setup的第一个参数，是props，也就是申明的父传子的参数
    setup(props) {
        let name3 = toRef(props,"name");

        function handleClick() {
            console.log("我点击了！");
            name3.value = "孙孜子错";
        }
        return {name3,handleClick};
    }
}
</script>

<style>

</style>